import numpy as np
import random
import time

class generator:
    def __init__(self, Num=5, length=100, begin=10, step=5) -> None:
        self.array1 = []
        self.array = []
        self.Num = Num
        self.length = length
        be = begin
        for n in range(Num):
            array1 = []
            for i in range(length):
                ite = random.randint(be, be + step)
                array1.append(ite)
                be = ite + step
            # 产生乱序的测试集
            array = [i for i in array1]
            seeds = int(time.time()) % 909
            random.seed(seeds)

            random.shuffle(array)
            self.array1.append(array1)
            self.array.append(array)
            # 为了让测试集看起来足够随机
            seeds = int(time.time()) % 990
            random.seed(seeds)
            be = begin + random.choice(array1) % 10

    def __str__(self) -> str:
        sorted_str = "Sorted set is:\n"
        test_str = "Test set is:\n"

        for i in range(self.Num):
            sorted_str += str(self.array1[i]) + '\n'
            test_str += str(self.array[i]) + '\n'

        return test_str + sorted_str

    def __getitem__(self, index):
        return [self.array1[index], self.array[index]]


array1 = list(range(0,10))
array = np.random.choice(10,10,replace = False)

if __name__ == "__main__":
    c = [20,30,40]
    a = []
    b = generator(length=c[1])
    for i in range(len(c)):
        b = generator(length=c[1])
        a.append(b)
    print(b)